<?php

namespace app\admin\model\sum\video;

use app\admin\model\sum\Common;

class Comment extends Common
{
    // 表名
    protected $name = 'sum_video_comment';

    // 追加属性
    protected $append = [
        'image_url',
    ];
    public function getImageUrlAttr($value, $data)
    {
        $image_url = $data['image']?cdnurl($data['image'], true):'';
        return $image_url;
    }
    public function getUserNicknameAttr($value, $data)
    {
        $value = $value ?: ($data['user_nickname'] ?? '');

        return $value ? string_hide($value, 2) : $value;
    }
    public function getUserAvatarAttr($value, $data)
    {
        $value = $value ?: ($data['user_avatar'] ?? '');
        return $value ? cdnurl($value,true) : $value;
    }
}
